package com.xxgc.helloworld.controller;

import com.xxgc.helloworld.po.Info;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@PropertySource(value = "classpath:system.properties")
@RequestMapping("/info")
@Api(value="hello接口",tags ="用于返回helloworld",description = "测试helloworld")
public class HelloController {
    @Value("${system.name}")
    private String system;

    @ApiOperation(value = "获取helloworld",notes = "获取helloworld")
    @GetMapping("/hello")
    @ResponseBody
    public Info hello(){
        return new Info(200,system+"hello world");
    }

    @ApiOperation(value = "给什么返回什么",notes = "你给什么返回什么")
    @GetMapping("/getMsg")
    @ResponseBody
    public Info getMsg(@ApiParam(name="msg",value="信息",required = true) String msg){
        return new Info(-201,msg);
    }
}
